const { uploadFiles } = require("../utils/upload.js");

//上传图片
async function upload(req,res,next){
   const images = uploadFiles({
       path:"./public/temp",
       key :"file",
       size : 1000,
   });
   console.log(images);
   images(req,res,function(error){
       if(error){
           console.log("图片上传失败",error );
       }else{
           res.send({
               status:1,
               message:"上传成功",
               data:req.files.map(item =>item.filename),
           })
       }
   })
}

module.exports = { upload,}